/*
 * Copyright (C) 2021 Realtek Semiconductor Corp.
 * All Rights Reserved.
 *
 * This program is the proprietary software of Realtek Semiconductor
 * Corporation and/or its licensors, and only be used, duplicated,
 * modified or distributed under the authorized license from Realtek.
 *
 * ANY USE OF THE SOFTWARE OTHER THAN AS AUTHORIZED UNDER
 * THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
 *
 * Purpose : Definition of ME handler: XG-PON downstream management performance monitoring history data (345)
 *
 * Feature : The file includes the following modules and sub-modules
 *           (1) ME handler: XG-PON downstream management performance monitoring history data  (345)
 */

#include "app_basic.h"
#ifndef OMCI_X86
#include "rtk/stat.h"
#endif

MIB_TABLE_INFO_T gMibXgponDsMangPmTableInfo;
MIB_ATTR_INFO_T  gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ATTR_NUM];
MIB_TABLE_XGPONDSMANGPMHD_T gMibXgponDsMangPmDefRow;
MIB_TABLE_OPER_T gMibXgponDsMangPmOper;

static UINT8    aXgponDsMangPmTcaAlmNumber[MIB_TABLE_XGPONDSMANGPMHD_ATTR_NUM];
static UINT8    aXgponDsMangPmTcaAttrMap[MIB_TABLE_XGPONDSMANGPMHD_ATTR_NUM];


GOS_ERROR_CODE XGPON_ds_mang_pm_CfgMe(void* pOldRow, void* pNewRow, MIB_OPERA_TYPE operationType, MIB_ATTRS_SET attrSet, UINT32 pri)
{
    GOS_ERROR_CODE                  ret;
    UINT32                          entrySize;
    MIB_TABLE_INDEX                 tableIndex;
    MIB_TABLE_ANIG_T                mibAniG;
    MIB_TABLE_XGPONDSMANGPMHD_T         mibCurrentBin;
    MIB_TABLE_XGPONDSMANGPMHD_T        *pMibXgponDsMangPmhd;


    pMibXgponDsMangPmhd = (MIB_TABLE_XGPONDSMANGPMHD_T *)pNewRow;

    // check if corresponding ANI-G exists
    mibAniG.EntityID = pMibXgponDsMangPmhd->EntityId;
    ret = MIB_Get(MIB_TABLE_ANIG_INDEX, &mibAniG, sizeof(MIB_TABLE_ANIG_T));
    if (GOS_OK != ret)
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(MIB_TABLE_ANIG_INDEX), mibAniG.EntityID);

        return GOS_FAIL;
    }


    tableIndex = MIB_TABLE_XGPON_DS_MANG_PMHD_INDEX;
    entrySize = MIB_GetTableEntrySize(tableIndex);

    switch (operationType)
    {
        case MIB_ADD:
            // sync control block data from history bin to current bin
            if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, pMibXgponDsMangPmhd, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), pMibXgponDsMangPmhd->EntityId);
            }

            ret = mib_alarm_table_add(tableIndex, pNewRow);
            break;

        case MIB_DEL:
            ret = mib_alarm_table_del(tableIndex, pOldRow);
            break;

        case MIB_SET:
            mibCurrentBin.EntityId = pMibXgponDsMangPmhd->EntityId;
            if (GOS_OK != MIB_GetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Current bin not found in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), mibCurrentBin.EntityId);

                return GOS_FAIL;
            }

            // sync control block data from history bin to current bin
            mibCurrentBin.ThresholdID = pMibXgponDsMangPmhd->ThresholdID;
            if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
            {
                OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                    __FUNCTION__, MIB_GetTableName(tableIndex), mibCurrentBin.EntityId);
            }
            break;

        default:
            break;
    }

    return ret;
}

GOS_ERROR_CODE XGPON_ds_mang_pm_handler(MIB_TABLE_INDEX        tableIndex,
                                                omci_me_instance_t      instanceID,
                                                omci_pm_oper_type_t     operType,
                                                BOOL                    *pIsTcaRaised)
{
    GOS_ERROR_CODE                  ret;
    UINT32                          entrySize;
    MIB_TABLE_ANIG_T                mibAniG;
    MIB_TABLE_XGPONDSMANGPMHD_T     mibXgponDsMangPm;
    MIB_TABLE_XGPONDSMANGPMHD_T     mibCurrentBin;
    omci_xgpon_stat_t               portCntrs;
    omci_xgpon_stat_t               *pPortCntrs = (omci_xgpon_stat_t*)&portCntrs;

    if (!pIsTcaRaised)
        return GOS_ERR_PARAM;

    // get table entry size
    entrySize = MIB_GetTableEntrySize(tableIndex);

    mibAniG.EntityID = instanceID;
    if (GOS_OK != MIB_Get(MIB_TABLE_ANIG_INDEX, &mibAniG, sizeof(MIB_TABLE_ANIG_T)))
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(MIB_TABLE_ANIG_INDEX), mibAniG.EntityID);

        return GOS_FAIL;
    }

    mibXgponDsMangPm.EntityId = instanceID;
    if (GOS_OK != MIB_Get(tableIndex, &mibXgponDsMangPm, entrySize))
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Instance not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);

        return GOS_FAIL;
    }

    mibCurrentBin.EntityId = instanceID;
    if (GOS_OK != MIB_GetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
    {
        OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Current bin not found in %s: %s, 0x%x",
            __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);

        return GOS_FAIL;
    }

    if (OMCI_PM_OPER_RESET == operType)
    {
        memset(&mibCurrentBin, 0, entrySize);
        mibCurrentBin.EntityId = instanceID;
        mibCurrentBin.ThresholdID = mibXgponDsMangPm.ThresholdID;

        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        if (GOS_OK != MIB_Set(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set instance error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        return GOS_OK;
    }

    if(OMCI_PM_OPER_GET_CURRENT_DATA == operType)
    {
        omci_pm_update_xgpon_stat(OMCI_PM_OPER_GET_CURRENT_DATA, 
            (OMCI_XGPON_PM_BITMAP_OMCI | OMCI_XGPON_PM_BITMAP_RX_PLAOM));
    }

    if (OMCI_PM_OPER_UPDATE == operType ||
        OMCI_PM_OPER_UPDATE_AND_SWAP == operType ||
        OMCI_PM_OPER_GET_CURRENT_DATA == operType)

    {

        // update PM values
        if (GOS_OK == omci_pm_getCurrent_xgpon_stat(instanceID,pPortCntrs))
        {
            m_omci_pm_update_reset_u32_attr(pPortCntrs->ploamMicErrCnt, mibCurrentBin.PloamMicErrCnt);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->dsPloamMsgCnt, mibCurrentBin.DsPloamMsgCnt);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->profileMsgRecv, mibCurrentBin.ProfileMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->rangingTimeMsgRecv, mibCurrentBin.RangingTimeMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->deactivateOnuIDMsgRecv, mibCurrentBin.DeactivateOnuIDMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->disableSnMsgRecv, mibCurrentBin.DisableSnMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->requestReistrationMsgRecv, mibCurrentBin.RequestReistrationMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->assignAllocIDMsgRecv, mibCurrentBin.AssignAllocIDMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->keyCtrlMsgRecv, mibCurrentBin.KeyCtrlMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->slpAllowMsgRecv, mibCurrentBin.SlpAllowMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->baselineOmciMsgRecvCnt, mibCurrentBin.BaselineOmciMsgRecvCnt);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->extendedOmciMsgRecvCnt, mibCurrentBin.ExtendedOmciMsgRecvCnt);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->assignOnuIDMsgRecv, mibCurrentBin.AssignOnuIDMsgRecv);
            m_omci_pm_update_reset_u32_attr(pPortCntrs->omciMicErrCnt, mibCurrentBin.OmciMicErrCnt);
        }

        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        ret = omci_pm_is_threshold_crossed(tableIndex, instanceID,
                &mibCurrentBin, aXgponDsMangPmTcaAlmNumber, aXgponDsMangPmTcaAttrMap, NULL, pIsTcaRaised);
        if (GOS_OK != ret && GOS_ERR_NOT_FOUND != ret)
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Check threshold error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
    }

    if (OMCI_PM_OPER_SWAP == operType || OMCI_PM_OPER_UPDATE_AND_SWAP == operType)
    {
        // swap PM values
        mibCurrentBin.IntEndTime++;
        mibXgponDsMangPm.IntEndTime = mibCurrentBin.IntEndTime;

        if (GOS_OK != MIB_Set(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set instance error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }

        memset(&mibCurrentBin, 0, entrySize);
        mibCurrentBin.EntityId = instanceID;
        mibCurrentBin.ThresholdID = mibXgponDsMangPm.ThresholdID;
        mibCurrentBin.IntEndTime = mibXgponDsMangPm.IntEndTime;

        if (GOS_OK != MIB_SetPmCurrentBin(tableIndex, &mibCurrentBin, entrySize))
        {
            OMCI_LOG(OMCI_LOG_LEVEL_ERR, "Set current bin error in %s: %s, 0x%x",
                __FUNCTION__, MIB_GetTableName(tableIndex), instanceID);
        }
    }

    return GOS_OK;
}

GOS_ERROR_CODE mibTable_init(MIB_TABLE_INDEX tableId)
{

    if(!IS_G987_SYSTEM())
    {
        OMCI_PRINT("Ignore classId:%d,only support on G.987 ONU", OMCI_ME_CLASS_XGPON_DS_MANG_PMHD);
        return GOS_FAIL;
    }

    gMibXgponDsMangPmTableInfo.Name = "XgponDsMangPm";
    gMibXgponDsMangPmTableInfo.ShortName = "XGPONDSMANGPMHD";
    gMibXgponDsMangPmTableInfo.Desc = " XG-PON downstream management performance monitoring history data ";
    gMibXgponDsMangPmTableInfo.ClassId = (UINT32)(OMCI_ME_CLASS_XGPON_DS_MANG_PMHD);
    gMibXgponDsMangPmTableInfo.InitType = (UINT32)(OMCI_ME_INIT_TYPE_OLT);
    gMibXgponDsMangPmTableInfo.StdType = (UINT32)(OMCI_ME_TYPE_STANDARD_PM);
    gMibXgponDsMangPmTableInfo.ActionType = (UINT32)(OMCI_ME_ACTION_CREATE | OMCI_ME_ACTION_DELETE | OMCI_ME_ACTION_SET | OMCI_ME_ACTION_GET | OMCI_ME_ACTION_GET_CURRENT_DATA);
    gMibXgponDsMangPmTableInfo.pAttributes = &(gMibXgponDsMangPmAttrInfo[0]);

    gMibXgponDsMangPmTableInfo.attrNum = MIB_TABLE_XGPONDSMANGPMHD_ATTR_NUM;
    gMibXgponDsMangPmTableInfo.entrySize = sizeof(MIB_TABLE_XGPONDSMANGPMHD_T);
    gMibXgponDsMangPmTableInfo.pDefaultRow = &gMibXgponDsMangPmDefRow;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "EntityId";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Name = "IntEndTime";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ThresholdID";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "PloamMicErrCnt";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "DsPloamMsgCnt";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ProfileMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "RangingTimeMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "DeactivateOnuIDMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "DisableSNMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "RequestReistrationMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "AssignAllocIDMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "KeyCtrlMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "SlpAllowMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "BaselineOmciMsgRecvCnt";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "ExtendedOmciMsgRecvCnt";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Name = "AssignOnuIDMsgRecv";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Name = "OmciMicErrCnt";


    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Entity ID";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Interval End Time";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Threshold Data ID";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "PLOAM  message integrity check (MIC)  error count";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Downstream PLOAM messages count";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Profile messages received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Ranging_time  messages  received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Deactivate_ONU-ID  messages  received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Disable_serial_number  messages  received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Request_registration  messages  received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Assign_alloc-ID messages receive";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Key_control messages received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Sleep_allow messages received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Baseline  OMCI  messages  received  count";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Extended  OMCI  messages  received  count";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "Assign_ONU-ID messages received";
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Desc = "OMCI  MIC  error  count";


    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT8;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT16;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].DataType = MIB_ATTR_TYPE_UINT32;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].Len = 1;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].Len = 2;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].Len = 4;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = TRUE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].IsIndex = FALSE;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = TRUE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].MibSave = FALSE;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_HEX;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OutStyle = MIB_ATTR_OUT_DEC;


    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_SBC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ | OMCI_ME_ATTR_ACCESS_WRITE | OMCI_ME_ATTR_ACCESS_SBC;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OltAcc = OMCI_ME_ATTR_ACCESS_READ;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].AvcFlag = FALSE;

    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ENTITYID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_INTENDTIME_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_THRESHOLDID_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = OMCI_ME_ATTR_TYPE_MANDATORY;
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DSPLOAMMSGCNT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_PROFILEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_RANGINGTIMEMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DEACITVATETONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_DISABLESNMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_REQUESTREGISTMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNALLOCIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_KEYCTRLMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_SLPALLOWMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_BASELINEOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_EXTENDEDOMCIMSGRECVCNT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_ASSIGNONUIDMSGRECV_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);
    gMibXgponDsMangPmAttrInfo[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX].OptionType = (OMCI_ME_ATTR_TYPE_MANDATORY | OMCI_ME_ATTR_TYPE_PM);

    memset(&(gMibXgponDsMangPmDefRow.EntityId), 0x00, sizeof(gMibXgponDsMangPmDefRow.EntityId));
    memset(&(gMibXgponDsMangPmDefRow.IntEndTime), 0x00, sizeof(gMibXgponDsMangPmDefRow.IntEndTime));
    memset(&(gMibXgponDsMangPmDefRow.ThresholdID), 0x00, sizeof(gMibXgponDsMangPmDefRow.ThresholdID));
    memset(&(gMibXgponDsMangPmDefRow.PloamMicErrCnt), 0x00, sizeof(gMibXgponDsMangPmDefRow.PloamMicErrCnt));
    memset(&(gMibXgponDsMangPmDefRow.DsPloamMsgCnt), 0x00, sizeof(gMibXgponDsMangPmDefRow.DsPloamMsgCnt));
    memset(&(gMibXgponDsMangPmDefRow.ProfileMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.ProfileMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.RangingTimeMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.RangingTimeMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.DeactivateOnuIDMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.DeactivateOnuIDMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.DisableSnMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.DisableSnMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.RequestReistrationMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.RequestReistrationMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.AssignAllocIDMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.AssignAllocIDMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.KeyCtrlMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.KeyCtrlMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.SlpAllowMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.SlpAllowMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.BaselineOmciMsgRecvCnt), 0x00, sizeof(gMibXgponDsMangPmDefRow.BaselineOmciMsgRecvCnt));
    memset(&(gMibXgponDsMangPmDefRow.ExtendedOmciMsgRecvCnt), 0x00, sizeof(gMibXgponDsMangPmDefRow.ExtendedOmciMsgRecvCnt));
    memset(&(gMibXgponDsMangPmDefRow.AssignOnuIDMsgRecv), 0x00, sizeof(gMibXgponDsMangPmDefRow.AssignOnuIDMsgRecv));
    memset(&(gMibXgponDsMangPmDefRow.OmciMicErrCnt), 0x00, sizeof(gMibXgponDsMangPmDefRow.OmciMicErrCnt));

    memset(&gMibXgponDsMangPmOper, 0x0, sizeof(MIB_TABLE_OPER_T));
    gMibXgponDsMangPmOper.meOperDrvCfg = XGPON_ds_mang_pm_CfgMe;
    gMibXgponDsMangPmOper.meOperConnCfg = NULL;
    gMibXgponDsMangPmOper.meOperConnCheck = NULL;
    gMibXgponDsMangPmOper.meOperAvlTreeAdd = NULL;
    gMibXgponDsMangPmOper.meOperDump = omci_mib_oper_dump_default_handler;
    gMibXgponDsMangPmOper.meOperPmHandler = XGPON_ds_mang_pm_handler;

    // for PM ME only, indicates the Threshold value attribute mapping and alarm number
    memset(aXgponDsMangPmTcaAlmNumber, 0, sizeof(aXgponDsMangPmTcaAlmNumber));
    aXgponDsMangPmTcaAlmNumber[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX] = 0;
    aXgponDsMangPmTcaAlmNumber[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX] = 1;

    memset(aXgponDsMangPmTcaAttrMap, 0, sizeof(aXgponDsMangPmTcaAttrMap));
    aXgponDsMangPmTcaAttrMap[MIB_TABLE_XGPONDSMANGPMHD_PLOAMMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX] = 1;
    aXgponDsMangPmTcaAttrMap[MIB_TABLE_XGPONDSMANGPMHD_OMCIMICERRCNT_INDEX - MIB_TABLE_FIRST_INDEX] = 2;

    MIB_TABLE_XGPON_DS_MANG_PMHD_INDEX = tableId;
    MIB_InfoRegister(tableId, &gMibXgponDsMangPmTableInfo, &gMibXgponDsMangPmOper);

    return GOS_OK;
}
